<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>07_$ref(s)的使用</title>
</head>
<body>
    <div id="app">
        <p ref="testP" @click="getPRef">p标签...</p>
        <cpn></cpn>
    </div>
</body>

<template id="aa">
    <div>
        <h3 ref="testComponet" @click="getTestComponetRef">xpxpxpxp...</h3>
    </div>
</template>

<script src="../vue.js"></script>
<script>
    new Vue({
        el: '#app',
        methods: {
            getPRef(){
                console.log(this.$refs.testP.innerText);
            }
        },
        components:{
            'cpn': {
                template: '#aa',
                methods: {
                    getTestComponetRef(){
                        console.log(this.$refs.testComponet);
                    }
                }
            },
        }
    })
</script>
</html>